package com.airport.ticket.config;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.Filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.airport.ticket.filter.LoginFilter;

@Configuration
public class FilterConfig {
    /**
     * 基础过滤器
     * @return
     */
    @Bean
    public FilterRegistrationBean<Filter> baseFilter(){
    	List<String> urlList = new ArrayList<String>();
    	urlList.add("/admin/*");
        FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new LoginFilter());
        filterRegistrationBean.setUrlPatterns(urlList);
        filterRegistrationBean.setOrder(1);
        return filterRegistrationBean;
    }
}